package com.boot.exception;

import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.servlet.ModelAndView;

@ControllerAdvice
@Slf4j
public class ExceptionAdviceHandler {

    /**
     * 捕获未授权异常
     * @param request
     * @param e
     * @return
     */
    @ExceptionHandler({Exception.class})
    public ModelAndView processShiroUnauthenticatedException(Exception e) {
        String message = e.getMessage();
        log.debug("message--->{}",e.getMessage());
        ModelAndView mv = new ModelAndView("error");
        mv.addObject("error",e.getMessage());
        return mv;
    }

}
